-
Notifications
You must be signed in to change notification settings - Fork 4
build: use meson to compile at build time instead of runtime #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
build: use importlib to find library
so it works in editable mode as supported by meson-python
|
now 90% less janky, ctypes loads the library in both editable and built installations. |
|
Hi, sorry, just saw your PR after I begun rising the required python version (I randomly installed invokeai today and saw that patchmatch wasnt working...). I will take a look at it these days, sounds pretty nice! |
|
When I do a clean installation on my Mac, it is not building the lib and the python examples are failing. |
|
On mac it didn't attempt to build during installation at all? Huh, didn't expect that. If you explicitly do |
|
Yes, it throws 4 warnings, but succeeds in building the wheel |
|
|
||
| # Compile if we didn't find a platform-compatible version (and it's not compiled already) | ||
| if pypatchmatch_lib is None: | ||
| pypatchmatch_lib = "libpatchmatch.so" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when I change line 161 to pypatchmatch_lib = "libpatchmatch.dylib", it seems to be working properly on my Mac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a check to use than name when platform is darwin.
It's suspicious to me to have to hardcode these extensions here rather than using a more standardized interface that already knows these platform-specific conventions, but I didn't find one of those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was playing around with Windows to see if I can get it working there as well, but I only have access to a VM which runs on ARM, which is why I think I am failing ...
What's nagging me about the dylib: When I build the main branch on my Mac, it is generating a libpatchmatch.so instead. So maybe there is a attribute in meson.build to change that behaviour 🤔
An attempt to get it to build libpatchmatch.so at build time, so it can be distributed in wheels—or when wheels aren't available, have it build at install time instead of runtime.
Notes:
__init__.pyandmeson.build